com.doclinx.ftxml
Class InputCallback

java.lang.Object
  |
  +--com.doclinx.ftxml.InputCallback

public class InputCallback
extends java.lang.Object

Extendable callback class that enables an application to control opening the input source. The application extends this class in order to implement the callback feature allowing the catAddFile function to call back to the application for file opening/closing. The callback class contains the parameter data passed between the API and the application. The functions in this class are called while processing the catAddFile() method. The default action of the class is to process a single file. Note that the class object is passed into the API by setting the sr_f2 object in the SRC2STF_PARMS parameter block.


Field Summary
static int ATITLE
          parms: array index for alternate document title.
static int ERR_IO
          status: error setting -- input stream I/O error.
static int ERR_OPEN
          status: error setting -- input stream open error.
static int ERR_PARM
          status: error setting -- bad parameter (e.g. parms array bad).
 java.lang.String errMsg
          errMsg: Error message buffer.
static int FILEKEY
          parms: array index for KEY (usually file name).
static int FLAG_SRCFILE
          Default callback setting -- process one file.
protected  java.io.InputStream isInput
           
static int LASTMOD
          parms: array index for last mod, date (string rep. of Long value).
static int LENGTH
          parms: array index for file length (string rep. of Long value).
static int NOMORE
          status: setting if openStream worked OK, but at END of input list.
static int OK
          status: setting if openStream worked correctly.
 java.lang.String[] parms
          parms: String array of entry objects passed between callback and API.
static int SSOURCE
          parms: array index of sSource parameter to catAddFile() call.
 int status
          errMsg: Status code.
static int URL
          parms: array index for URL.
 
Constructor Summary
InputCallback()
          Constructor with default value for parameters.
InputCallback(int pFlags)
          Constructor with setting type basic file open callback,
 
Method Summary
 boolean close()
          Callback that may be "extended" to allow application to close the stream and do any cleanup.
 java.io.InputStream getStream()
          Returns the opened stream object set in the openStream call.
 boolean openStream()
          Callback that MUST be "extended" to permit applications to open a file as an InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAG_SRCFILE

public static final int FLAG_SRCFILE
Default callback setting -- process one file.

See Also:
Constant Field Values

OK

public static final int OK
status: setting if openStream worked correctly.

See Also:
Constant Field Values

NOMORE

public static final int NOMORE
status: setting if openStream worked OK, but at END of input list.

See Also:
Constant Field Values

ERR_PARM

public static final int ERR_PARM
status: error setting -- bad parameter (e.g. parms array bad).

See Also:
Constant Field Values

ERR_OPEN

public static final int ERR_OPEN
status: error setting -- input stream open error.

See Also:
Constant Field Values

ERR_IO

public static final int ERR_IO
status: error setting -- input stream I/O error.

See Also:
Constant Field Values

URL

public static final int URL
parms: array index for URL.

See Also:
Constant Field Values

FILEKEY

public static final int FILEKEY
parms: array index for KEY (usually file name).

See Also:
Constant Field Values

ATITLE

public static final int ATITLE
parms: array index for alternate document title.

See Also:
Constant Field Values

LENGTH

public static final int LENGTH
parms: array index for file length (string rep. of Long value).

See Also:
Constant Field Values

LASTMOD

public static final int LASTMOD
parms: array index for last mod, date (string rep. of Long value).

See Also:
Constant Field Values

SSOURCE

public static final int SSOURCE
parms: array index of sSource parameter to catAddFile() call.

See Also:
Constant Field Values

isInput

protected java.io.InputStream isInput

parms

public java.lang.String[] parms
parms: String array of entry objects passed between callback and API. These are items are used to build catalog entries and are defined as follows:
     [0] URL name (optional)
     [1] Input path or identifier (required)
     [2] Alternate title (optional)
     [3] Input length (Long, optional)
     [4] Last modified time (Long, required for date updates)
     [5] Copy of sSource parameter in call to catAddFile()
 


errMsg

public java.lang.String errMsg
errMsg: Error message buffer. Used by either API or user when error is found.


status

public int status
errMsg: Status code. Used to indicate an error, success, or when end of an input list is detected. NOMORE indicates EOL.

Constructor Detail

InputCallback

public InputCallback(int pFlags)
Constructor with setting type basic file open callback,


InputCallback

public InputCallback()
Constructor with default value for parameters.

Method Detail

openStream

public boolean openStream()
Callback that MUST be "extended" to permit applications to open a file as an InputStream. The application can use the sSource parameter to indicate the stream selection or add data variables in the class extention definition. A request to open the stream is made until the function returns a "false" value and the status variable is set to "NOMORE". This function is called to open the stream by catAddFile when the mode parameter is ADD_MODE_INPUTCBACK. The default method uses the sSource parameter as a file name and then opens a stream to this file. The second call to the open indicates that there are no more streams. See ADD_MODE_INPUTCBACK for details.

Returns:
true if open is successful, false if error or at end. If at end, the member variable status should be set to NOMORE.
Throws:
**none

close

public boolean close()
Callback that may be "extended" to allow application to close the stream and do any cleanup. This is called by the API once the stream has been processed.

Returns:
true if open is successful, false if error in open process.
Throws:
**none

getStream

public final java.io.InputStream getStream()
Returns the opened stream object set in the openStream call.

Returns:
The InputStream object.
Throws:
**none